<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>11.验证</title>
        <!-- 引入Vue -->
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="app">
            <input type="text" v-model="username" /> 
            <span>{{regUsername}}</span>
        </div>
    </body>

    <script>
        new Vue({
            el:"#app",
            data:{
                username:""
            },
            computed:{
                regUsername(){

                    // 正则
                    let Reg = /[0-9a-zA-Z]{6,12}$/;

                    return Reg.test(this.username) ? "ok" :"请输入正确的号码"

                    
                }
            }
        })
    </script>
</html>